/**
 * 
 */
package co.edu.udistrital.analyzer.business.orm.vo;

import java.util.Map;

import co.edu.udistrital.analyzer.newversion.DocumentSearchDto;

/**
 * @author Alejo
 *
 */
public class DocumentClassifyDTO extends DocumentSearchDto {
    
	/**
	 * 
	 */
	private static final long serialVersionUID = 4617385503210011043L;
	private static final String FILE_SEPARATOR = System.getProperty("file.separator");
    /**
     * The document categories
     */
    private Map<String, Double> categories;

	/**
	 * 
	 */
	public DocumentClassifyDTO() {
	}

	/**
	 * 
	 */
	public DocumentClassifyDTO(DocumentSearchDto document) {
		this.setIdDocument(document.getIdDocument());
		this.setNameDocument(document.getNameDocument());
	}

	/**
	 * @return Retorna el valor de categories
	 */
	public Map<String, Double> getCategories() {
		return categories;
	}

	/**
	 * Asigna un nuevo valor acategories
	 * 
	 * @param categories Nuevo valor de categories
	 */
	public void setCategories(Map<String, Double> categories) {
		this.categories = categories;
	}
	
	public String getShortName () {
		String shortName = "";
		if (getNameDocument() != null) {
			shortName = getNameDocument();
			if (shortName.contains(FILE_SEPARATOR)) {
				shortName = shortName.substring(shortName.lastIndexOf(FILE_SEPARATOR) + 1);
			}
			if (shortName.length() > 50) {
				shortName = shortName.substring(0, 50);
			}
		}
		
		return shortName;
	}

}
